let taskId;
let node = document.getElementById("winner");
let buttonNode = document.getElementById("start");
let maxNum = 36;
const svg = "<svg height=\"32\" width=\"32\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n" +
    "            <path d=\"M0 0H24V24H0z\" fill=\"none\"></path>\n" +
    "            <path d=\"M16.5 3C19.538 3 22 5.5 22 9c0 7-7.5 11-10 12.5C9.5 20 2 16 2 9c0-3.5 2.5-6 5.5-6C9.36 3 11 4 12 5c1-1 2.64-2 4.5-2z\"></path>\n" +
    "        </svg>"

function drawWinner() {
    if (buttonNode.innerText === "开始") {
        clearInterval(taskId);
        taskId = setInterval(function () {
            const winner = Math.floor(Math.random() * maxNum) + 1;
            node.innerText = winner.toString();
        }, 10);
        buttonNode.innerHTML = "停止".concat(svg);
    } else {
        clearInterval(taskId);
        buttonNode.innerHTML = "开始".concat(svg);
    }
}